<?php

class utilDes
{
    public static function decrypt($sString, $equalKey = 'sess_id', $sMasterKey = '')
    {
        if (empty($sMasterKey)) {
            $aMasterKey = utilDesKeyManager::getMasterKey();
            $sMasterKey = $aMasterKey['oldMasterKey'];
        }

        $utilDes = utilDesCbc::getInstance($sMasterKey);
        $sDecrypt = $utilDes->decrypt($sString);

        return $sDecrypt;
    }

    public static function encrypt($sString, $sMasterKey = '')
    {
        if (empty($sMasterKey)) {
            $aMasterKey = utilDesKeyManager::getMasterKey();
            $sMasterKey = $aMasterKey['oldMasterKey'];
        }

        $utilDesCbc = utilDesCbc::getInstance($sMasterKey);

        return $utilDesCbc->encrypt($sString);
    }
}
